{{ define "admin/gift" }}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
    <!-- Bootstrap core CSS -->
    <link href="/public/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Optional Bootstrap Theme -->
    <link href="data:text/css;charset=utf-8," data-href="/public/dist/css/bootstrap-theme.min.css" rel="stylesheet" id="bs-theme-stylesheet">
    <title>{{.Title}} - Go抽奖系统</title>
    <style type="text/css">
        footer {
            border-top: 5px solid seagreen;
            border-bottom: 1px solid #333333;
            /*background-color: #00AA88;*/
            background-color: hsl(209, 51%, 92%);
        }
        .table {
            height: 503px;
        }

        .navbar-brand:hover {
            background-color: #00ccff;
            font-size: 20px;
        }

        .navbar-nav li:hover {
            background-color: #00ccff;
            font-size: 20px;
        }

        body {
            font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
            font-size: 14px;
            line-height: 1.42857143;
            color: #333;
            background-color: #FFE;
        }

        /*.success {*/
        /*    height: 20px*/
        /*}*/

        /*.table td {*/
        /*    height: 20px;*/
        /*}*/

    </style>
</head>

<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/admin/">抽奖后台</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li {{if eq .Channel "gift"}}class="active"{{end}}><a href="/admin/gift/">奖品管理</a></li>
                <li {{if eq .Channel "code"}}class="active"{{end}}><a href="/admin/code/">优惠券管理</a></li>
                <li {{if eq .Channel "result"}}class="active"{{end}}><a href="/admin/result/">中奖记录数据</a></li>
                <li {{if eq .Channel "user"}}class="active"{{end}}><a href="/admin/user/">用户管理 <span class="sr-only">(current)</span></a></li>
                <li {{if eq .Channel "blackip"}}class="active"{{end}}><a href="/admin/blackip/">IP黑名单</a></li>
            </ul>
            {{/*<form class="navbar-form navbar-left">*/}}
            {{/*<div class="form-group">*/}}
            {{/*<input type="text" class="form-control" placeholder="Search">*/}}
            {{/*</div>*/}}
            {{/*<button type="submit" class="btn btn-default">Submit</button>*/}}
            {{/*</form>*/}}
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div>
    <!-- Render the current template here -->
    <div class="panel-heading">
        <a href="/admin/gift/edit" style="height:18px; padding:6px;">添加奖品</a>
        (总共 {{.Total}} 条记录)
    </div>

    <table class="table">
        <thead>
        <tr>
            <th>位置</th>
            <th>ID</th>
            <th title="【奖品池数量】">名称</th>
            <th title="总数 / 剩余数">数量</th>
            <th>概率</th>
            <th title="单位是天">周期</th>
            <th>图片</th>
            <th>类型</th>
            <th>数据</th>
            <th>开始时间</th>
            <th>结束时间</th>
            <th>更新时间</th>
            <th>管理</th>
        </tr>
        </thead>
        <tbody>
        {{range $i, $data := .Datalist}}

            <tr {{if eq $data.SysStatus 0}}class="success"{{end}}>
                <td>{{$data.Displayorder}}</td>
                <th scope="row">{{.Id}}</th>
                <td><a href="/admin/result?gift_id={{.Id}}">{{$data.Title}}</a></td>
                <td>{{$data.PrizeNum}} / {{.LeftNum}}</td>
                <td>{{$data.PrizeCode}}</td>
                <td title="{{FromUnixtime .PrizeBegin}} - {{FromUnixtime .PrizeEnd}}">
                    <a href="#" data-toggle="modal" data-target="#myModal"
                       onclick="showSharedGiftInfo('{{FromUnixtime .PrizeBegin}}', '{{FromUnixtime .PrizeEnd}}', '{{.PrizeData}}');return false;">
                        {{$data.PrizeTime}}天计划</a>
                </td>
                <td><img src="{{$data.Img}}" width="50"/></td>
                <td>{{$data.Gtype}}</td>
                <td>{{$data.Gdata}}</td>
                <td>{{FromUnixtime $data.TimeBegin}}</td>
                <td>{{FromUnixtime $data.TimeEnd}}</td>
                <td>{{FromUnixtime $data.SysUpdated}}</td>
                <td>
                    <a href="/admin/gift/edit?id={{.Id}}">修改</a>
                    {{if eq $data.SysStatus 0}}
                        <a href="/admin/gift/delete?id={{.Id}}">删除</a>
                    {{else}}
                        <a href="/admin/gift/reset?id={{.Id}}">恢复</a>
                    {{end}}
                    {{if eq .Gtype 2}}
                        <br/>
                        <a href="/admin/code?gift_id={{.Id}}">优惠券管理</a>
                    {{end}}

                </td>
            </tr>

        {{end}}
        </tbody>
    </table>

    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">
                        发奖周期和计划
                    </h4>
                </div>
                <div class="modal-body">
                    开始时间：
                    <span id="modal_time_begin">0</span>
                    <br/>
                    结束时间：
                    <span id="modal_time_end">0</span>
                    <br/>
                    <div id="modal_list" style="height:300px; overflow: auto;"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    {{/*<button type="button" class="btn btn-primary">提交更改</button>*/}}
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

    <script>
        function showSharedGiftInfo(pb, pe, data) {
            $('#modal_time_begin').html(pb);
            $('#modal_time_end').html(pe);
            var html = '';
            var i = 0;
            var datalist = JSON.parse(data);
            for(var t in datalist) {
                i += 1;
                var n = datalist[t];
                html = html + "&nbsp;&nbsp;" + i + "&nbsp;&nbsp;" + n + "<br/>\n";
            }
            $('#modal_list').html(html);
        }
    </script>
    <hr />
    <footer style="text-align: center;">
        <center>
            <table  width="640" border="0">
                <tr class="tt">
                    <td align="center" width="80"><a href="#"><font size="1"><b>关于我们&nbsp;&nbsp;&nbsp;&nbsp;|</b></font></a></td>
                    <td align="center" width="80"><a href="#"><font size="1"><b>About&nbsp;&nbsp;&nbsp;&nbsp;|</b></font></a></td>
                    <td align="center" width="80"><a href="#"><font size="1"><b>服务协议&nbsp;&nbsp;&nbsp;&nbsp;|</b></font></a></td>
                    <td align="center" width="80"><a href="#"><font size="1"><b>隐私政策 &nbsp;&nbsp;&nbsp;&nbsp;|</b></font></a></td>
                    <td align="center" width="80"><a href="#"><font size="1"><b>开放平台&nbsp;&nbsp;&nbsp;&nbsp;|</b></font></a></td>
                    <td align="center" width="80"><a href="#"><font size="1"><b>商务洽谈&nbsp;&nbsp;&nbsp;&nbsp;|</b></font></a></td>
                    <td align="center" width="80"><a href="#"><font size="1"><b>招聘&nbsp;&nbsp;&nbsp;&nbsp;|</b></font></a></td>
                    <td align="center" width="80"><a href="#"><font size="1"><b>客服中心&nbsp;&nbsp;&nbsp;&nbsp;</b></font></a></td>
                </tr>
            </table>
            <p><font size="1"><b>&copy;2022 - Go抽奖系统：&copy;:版权所有，计科三班，黄栋林</b></font></p>
            <address>E-mail:  huangdonglin@qq.com</address>
        </center>
    </footer>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/public/dist/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/public/dist/js/vendor/jquery.min.js"><\/script>')</script>
<script src="/public/dist/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
{{ end }}